<#include "/layout/header.ftl" />
<#import "/include/ui.ftl" as blue />

<script>

$(function()
{
	
});

function save_click()
{
	$.simpleValid("#div_form", function(obj)
	{
		$.simpleAjax("/wechat/wechat_save", obj, function(o)
		{
			$.successAlert("保存成功", "save_success()", 2000);
		});
	});
}
function save_success()
{
	window.location = "${path}/wechat/wechat_list";
}
</script>

<div class="am-form am-form-horizontal layout-padding-content" id="div_form">
<input type="hidden" name="id" value="${model.id!}"/>

	<fieldset>
		<legend><#if model.id??>修改<#else>添加</#if>微信公众号</legend>
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">代码</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="code" placeholder="输入微信公众号代码" class="am-form-field am-radius"  maxlength="50" value="${model.code!}" required/>
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">名称</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="name" placeholder="输入微信公众号名称" class="am-form-field am-radius"  maxlength="50" value="${model.name!}" required/>
				</div>
			</div>
		</div>

		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">状态</label>
				<div class="am-u-md-9 am-u-end">
					<select class="am-form-field am-radius" name="state" data-am-selected="{'btnWidth': '120px'}" required>
						<@blue.select list=map.state value=(model.state.index)!"0" />
					</select>
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">令牌</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="token" placeholder="输入微信公众号令牌" class="am-form-field am-radius"  maxlength="50" value="${model.token!}" required/>
				</div>
			</div>
		</div>

		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">类型</label>
				<div class="am-u-md-9 am-u-end">
					<select class="am-form-field am-radius" name="type" data-am-selected="{'btnWidth': '150px'}" required>
						<@blue.select list=map.wechatType value=(model.type.index)! />
					</select>
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">消息密钥</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="msgKey" placeholder="输入微信公众号消息密钥" class="am-form-field am-radius"  maxlength="50" value="${model.msgKey!}"/>
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">应用编号</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="appId" placeholder="输入微信公众号应用编号" class="am-form-field am-radius"  maxlength="50" value="${model.appId!}" />
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">应用密钥</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="appSecret" placeholder="输入微信公众号应用密钥" class="am-form-field am-radius"  maxlength="50" value="${model.appSecret!}" />
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">商户编号</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="mchId" placeholder="输入微信公众号商户编号" class="am-form-field am-radius"  maxlength="50" value="${model.mchId!}" />
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">商户密钥</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="mchKey" placeholder="输入微信公众号商户密钥" class="am-form-field am-radius"  maxlength="50" value="${model.mchKey!}" />
				</div>
			</div>
		</div>
		
		<div class="am-u-md-6">
			<div class="am-form-group">
				<label class="am-u-md-2 am-form-label am-padding-left-0 am-padding-right-0">网址</label>
				<div class="am-u-md-9 am-u-end">
					<input type="text" name="url" placeholder="输入微信公众号网址" class="am-form-field am-radius"  maxlength="200" value="${model.url!}" />
				</div>
			</div>
		</div>

		<div class="am-u-md-12 am-text-center div_btn">
			<a href="javascript:void(0)" onclick="save_click()" class="am-btn am-btn-primary am-radius">保存</a>
			<a href="javascript:void(0)" onclick="save_success()" class="am-btn am-btn-default am-radius am-margin-left">返回</a>
		</div>
	</fieldset>
</div>

<#include "/layout/footer.ftl" />